package com.example.service.webhook.business.insurance.repository;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.example.service.webhook.business.insurance.entity.VehicleInsuranceDetailInfoEntity;
import com.example.service.webhook.business.zhengxin.entity.CreditRecordDetailEntity;
import com.example.service.webhook.business.zhengxin.entity.PublicInformationEntity;
import com.example.service.webhook.business.zhengxin.entity.QueryInformationEntity;
import com.example.service.webhook.repository.base.BaseDAO;
import com.example.service.webhook.util.DateUtil;

@Repository
public class VehicleInsuranceDetailInfoRepository extends BaseDAO<VehicleInsuranceDetailInfoEntity>{
	
	@Resource(name="templateInsurance")
    private JdbcTemplate jdbcTemplate;

    public JdbcTemplate getJdbcTemplate() {
		return jdbcTemplate;
	}
    
    public void saveVehicleInsuranceDetailInfo(VehicleInsuranceDetailInfoEntity entity)throws Exception  {
    	entity.setCreateTime(DateUtil.getCurrentDate());
    	entity.setLastModifyTime(DateUtil.getCurrentDate());
		this.add(entity);
    }
    
    

   public void deleteVehicleInsuranceDetailInfo(String userId,String policyNum){
	   String tableName = "t_vehicle_insurance_detail";
	        StringBuilder sql = new StringBuilder("DELETE FROM ").append(tableName).append(" WHERE ").
	                append("userId='").append(userId).append("'").
	                append("and policyNum='").append(policyNum).append("'");

	         this.getJdbcTemplate().update(sql.toString());
   }
    
    
    
}
